home *** CD-ROM | disk | FTP | other *** search
/ Know Your Hockey - The Greatest Player Resource / Know Your Hockey: The Greatest Player Resource.iso / hockey / director / ktgcst.cst / 00049_Script_PopUpSubMenu Script--using Movie in a window < prev    next >
Text File  |  1998-09-28  |  2KB  |  67 lines

  1. -- the popup menu is a separate movie that is openined over the current movie
  2. -- the global gPop stores the name of the popup window
  3.  
  4. global gSubPop, gPopButtonState, gPop 
  5.  
  6.  
  7. -- launches and positions the popup menu
  8.  
  9. on InitSubPopMenu
  10.   if gSubPop =  (window "PopSubMenu") then
  11.     loseSubPop
  12.   else 
  13.     set gSubPop = window "PopSubMenu"
  14.     set the filename of gSubPop to "SubPop" -- insert the name of the menu movie here
  15.     set the windowtype of gSubPop to 2
  16.     FindSubMenuLocation
  17.     open gSubPop 
  18.   end if
  19.   
  20. end
  21.  
  22.  
  23. -- examines the current location of the stage  then positions the popup window correctly
  24.  
  25. on FindSubMenuLocation
  26.   set x = the rect of the stage
  27.   set topX = 160+(80+value(the top  of x)) -- position on stage offset by the stage pos on the screen and the submenu position
  28.   set topY = 43+(260+value(the left of x))-- position on stage offset by the stage pos on the screen and the submenu position
  29.   set BottomX = 332+topX-- bottom corner = top corner plus desired window size (in bold)
  30.   set BottomY = 96+TopY--bottom corner = top corner plus desired window size (in bold)
  31.   -- set BottomLeft = value(item 3 of temp)
  32.   -- set BottomRight = value(item 4 of temp)
  33.   set the rect of gSubPop to rect(TopX,TopY,BottomX,BottomY)
  34. end
  35.  
  36. -- closes the popup window
  37.  
  38. on LoseSubPop
  39.   if gSubPop = Empty or voidp(gSubPop) then exit
  40.   Close gSubPop
  41.   Forget gSubPop
  42.   Set gSubPop = Empty
  43. end
  44.  
  45.  
  46. -- set the button status on the popmenu to reflect the current selected screen
  47. -- called from the popmenu in first exit frame script and the from the placename
  48. -- buttons in the last line of the handler
  49.  
  50. on SetPopMenu
  51.   set the itemDelimiter to "."
  52.   set Name = the movieName
  53.   set N = item 1 of name
  54.   set Nnum = value(the last char of N)+28 -- uses the last char of the movie name(#)¼
  55. and adds an offset to it to get the correct sprite channel in the popwindow
  56.   set the itemDelimiter to ","
  57.   tell gPop
  58.     puppetsprite Nnum, 1
  59.     setat(gPopButtonState,Nnum,2)
  60.     set the membernum of sprite Nnum =  the membernum of sprite Nnum+1
  61.     set the visible of sprite Nnum to 1    
  62.     updatestage
  63.   end tell
  64. end
  65.  
  66.  
  67.